<?php
/**
 * Ora 后台管理模块
 *  @author  lan7
 *  @copyright lan7.net
 *  @version 2.0
 */

if(!defined('IN_ORA')) {
	exit('Access Denied');
}
class update extends mod{
	function update(){
		parent::__construct();
		import("lib.update");
	}

	/**
	 * 输出模板信息
	 *
	 */
	function tplXml(){
		$this->setTplDir(PUBLIC_PATH."admin/");
		$tpls = $this->db->getAll("select * from ".tn('theme')." order by Id desc");
		$this->assign("tpls",$tpls);
		$this->display("tplXml.html","text/xml");
	}
	/**
	 * 输出插件信息
	 *
	 */
	function pluginXml(){
		$this->setTplDir(PUBLIC_PATH."admin/");
		$pgs = $this->db->getAll("select * from ".tn('plugin')." order by Id desc");
		$this->assign("pgs",$pgs);
		$this->display("pluginXml.html","text/xml");
	}
	/**
	 * 下载模板风格包
	 *
	 */
	function getTpl(){
		$key = base64_decode($GLOBALS['_param']["key"]);
		if($key){
			$fp = @fopen(PUBLIC_PATH."tpl.log",'w+');
			@fputs($fp,$_SERVER["HTTP_REFERER"]);
			@fclose($fp);
			redirect(HTTP_HOST."/upload/zip/tpl_".$key.".zip",false);
		}
	}
	
	/**
	 * 插件包
	 *
	 */
	function getPlugin(){
		$key = base64_decode($GLOBALS['_param']["key"]);
		if($key){
			$fp = @fopen(PUBLIC_PATH."plugin.log",'w+');
			@fputs($fp,$_SERVER["HTTP_REFERER"]);
			@fclose($fp);
			redirect(HTTP_HOST."/upload/zip/plugin_".$key.".zip",false);
		}
	}
}
?>